var t = getApp();

Page({
    data: {
        assist_id: "",
        member_id: "",
        currentTime: parseInt(new Date().getTime() / 1e3),
        contactShow: !1,
        friendsShow: !1,
        assist: {},
        activity: {},
        member: {}
    },
    onLoad: function(i) {
        if (this.setData({
            assist_id: i.assist_id,
            member_id: i.member_id
        }), i.member_id && t._setMid(i.member_id), i.scene) {
            var a = decodeURIComponent(i.scene);
            if (a) {
                var s = [];
                s = a.split(",");
                for (var e = 0; e < s.length; e++) {
                    var n;
                    "id" == (n = s[e].split("="))[0] ? this.setData({
                        assist_id: n[1]
                    }) : "mid" == n[0] && (t._setMid(n[1]), this.setData({
                        member_id: n[1]
                    }));
                }
            }
        }
        this.getData();
    },
    callPhone: function() {
        wx.makePhoneCall({
            phoneNumber: this.data.activity.cservice_phone
        });
    },
    imgHeight: function(t) {
        console.log(t), this.setData({
            heightImg: t.detail.height
        });
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {
        var t = "/packageH/blindBox/blindBoxHelping/blindBoxHelping?assist_id=" + this.data.assist.id + "&member_id=" + this.data.assist.member_id;
        return {
            title: this.data.activity.activity_name ? this.data.activity.activity_name : "",
            path: t,
            imageUrl: this.data.activity.activity_img_src ? this.data.activity.activity_img_src : ""
        };
    },
    getData: function() {
        var i = this, a = t.getNetAddresss("plugin.blind-box.api.assist.get-assist");
        t._postNetWork({
            url: a,
            data: {
                id: i.data.assist_id,
                member_id: i.data.member_id
            },
            success: function(t) {
                var a = t.data;
                wx.hideLoading({
                    success: function(t) {}
                }), 1 == a.result ? i.setData({
                    assist: a.data.assist,
                    activity: a.data.assist.activity,
                    member: a.data.assist.member
                }) : (console.log(a), wx.showToast({
                    title: a.msg,
                    duration: 1e3,
                    icon: "none"
                }));
            },
            fail: function(t) {
                console.log(t.msg);
            }
        });
    },
    heplAssist: function() {
        var i = this, a = t.getNetAddresss("plugin.blind-box.api.assist.assist");
        t._postNetWork({
            url: a,
            data: {
                id: i.data.assist_id
            },
            success: function(t) {
                var a = t.data;
                wx.hideLoading({
                    success: function(t) {}
                }), 1 == a.result ? (i.setData({
                    friendsShow: !0
                }), i.getData()) : (console.log(a), wx.showToast({
                    title: a.msg,
                    duration: 1e3,
                    icon: "none"
                }));
            },
            fail: function(t) {
                console.log(t.msg);
            }
        });
    },
    gotoDetails: function() {
        wx.navigateTo({
            url: "/packageH/blindBox/blindBoxDetail/blindBoxDetail?id=" + this.data.activity.id
        });
    },
    generateAssist: function() {
        this.addJoinLog();
        var i = this, a = t.getNetAddresss("plugin.blind-box.api.assist.generate-assist");
        t._postNetWork({
            url: a,
            data: {
                id: i.data.activity.id
            },
            success: function(t) {
                var a = t.data;
                wx.hideLoading({
                    success: function(t) {}
                }), 1 == a.result ? wx.navigateTo({
                    url: "/packageH/blindBox/blindBoxDetail/blindBoxDetail?id=" + i.data.activity.id
                }) : wx.showToast({
                    title: a.msg,
                    duration: 1e3,
                    icon: "none"
                });
            },
            fail: function(t) {
                console.log(t.msg);
            }
        });
    },
    addJoinLog: function() {
        var i = t.getNetAddresss("plugin.blind-box.api.index.join-log");
        t._postNetWork({
            url: i,
            data: {
                id: this.data.activity.id
            },
            success: function(t) {
                wx.hideLoading({
                    success: function(t) {}
                });
            },
            fail: function(t) {
                console.log(t.msg);
            }
        });
    },
    goOrder: function() {
        wx.navigateTo({
            url: "/packageA/member/myOrder_v2/myOrder_v2?status=0"
        });
    },
    contactShowTap: function() {
        this.setData({
            contactShow: !0
        });
    },
    friendsShowClose: function() {
        this.setData({
            friendsShow: !1
        });
    },
    previewImage: function(t) {
        console.log("浏览图片");
        var i = this.data.activity.cservice_code_src;
        wx.previewImage({
            current: i,
            urls: [ i ]
        });
    },
    contactShowClose: function() {
        this.setData({
            contactShow: !1
        });
    }
});